import React from 'react'
import {useSelector,useDispatch} from 'react-redux'
import {incrementAction} from '../store/actions/counterAction'
export default function Counter() {
  const dispatch=useDispatch()
  const num=useSelector((state)=>{
    console.log('state',state);
    return state.counterKey.count
  })
  const increment=()=>{
    dispatch(incrementAction(3))
  }
  return (
    <div>
      <h2>{num}</h2>
      <button onClick={increment}>+</button>
    </div>
  )
}
